package org.concepts.java.antlr.validator;

import org.antlr.runtime.ANTLRStringStream;
import org.concepts.java.antlr.utils.AntlrUtils;
import org.junit.Test;

public class TestValLexer {

  @Test
  public void testNormalVariableDeclaration() {
    processInputUsingValLexer("name = Foo;");
  }

  @Test
  public void testStringVariableDeclaration() {
    processInputUsingValLexer("name = \"Foo Bar\";");
  }
  
  @Test
  public void testMultipleVariableDeclaration() {
    processInputUsingValLexer("firstName = Foo;\n age = 35;");
  }
  
  @Test
  public void testExpression() {
    processInputUsingValLexer("$age > 30");
  }
  
  /**
   * Process the input using {@link ValLexer}
   * 
   * @param input
   *          input. Cannot be null
   */
  private void processInputUsingValLexer(String input) {
    System.out.println("\n\nInput [" + input + "]");
    ValLexer valLexer = new ValLexer(new ANTLRStringStream(input));
    AntlrUtils.processAndPrintTokens(valLexer);
  }
  
}
